package com.common.model.validators;

import com.common.model.abstracts.AbstractRequest;
import com.common.model.abstracts.AbstractValidator;
import com.common.model.interfaces.IRequestAction;
import com.common.security.errors.ParserError;

public class ActionValidator extends AbstractValidator {

	private String action;
	
	public ActionValidator(IRequestAction action) {
		this.action = action.toString();
	}
	
	@Override
	public boolean validate(AbstractRequest abstractRequest) {
		if (!abstractRequest.getAction().equals(action)) {
			error = new ParserError(ParserError.ACTION_NOT_AVAILABLE);
			return false;
		}
		
		return true;
	}
}
